075f7b
@@ -50,6 +50,11 @@
public class TimerConsumer extends DefaultConsumer {
 
             @Override
             public void run() {
+                if (!isTaskRunAllowed()) {
+                    // do not run timer task as it was not allowed
+                    return;
+                }
+
                 try {
                     long count = counter.incrementAndGet();
 
@@ -80,6 +85,14 @@
public class TimerConsumer extends DefaultConsumer {
         task = null;
     }
 
+    /**
+     * Whether the timer task is allow to run or not
+     */
+    protected boolean isTaskRunAllowed() {
+        // only allow running the timer task if we can run and are not suspended
+        return isRunAllowed() && !isSuspended();
+    }
+
     protected void configureTask(TimerTask task, Timer timer) {
         if (endpoint.isFixedRate()) {
             if (endpoint.getTime() != null) {
